home *** CD-ROM | disk | FTP | other *** search
- Path: in1.uu.net!interaccess!usenet
- From: brianmcg@interaccess.com (Brian V. McGroarty)
- Newsgroups: comp.lang.c
- Subject: Re: help: benchmarking
- Date: 21 Mar 1996 14:13:47 GMT
- Organization: Internet Squire
- Message-ID: <4iro6r$2e9@nntp.interaccess.com>
- References: <4io0l2$pjc@news.umbc.edu>
- Reply-To: brianmcg@interaccess.com
- NNTP-Posting-Host: d222.nhe.interaccess.com
- X-Newsreader: Internet Squire 1.20
-
- Note that this information, as well as any implementation issues will be
- fairly topic- and system-specific. For further discussion, you will
- probably get better results if you post to a newsgroup dealing with your
- particular computer, your operating system or operating systems in general.
- /* not a flame */
-
-
- The Blue Twinkie wrote:
- >I'm writing a program that will basicly monitor computer usage.
- >I need to be able to see how much the CPU is used and how much the hard
- >drive
- >is accessed. I've seen programs that monitor these things, but I am at a
- >loss
- >when it comes to programming my own. I can't use up too much processor
- >time
- >in running the program... This is going on a network- I need to know how
- >much
- >a particular comupter is being accessed. Thanks for any help!
-
- CPU usage can be measured in several ways. One is to attach a monitoring
- routine to a timer interrupt. The routine would check what the current
- active task is either by viewing the kernel's task list or the location of
- the return pointer. The information about the current task would be used
- to determine the ratio of active task hits to insignificant priority or
- kernel "holding area" hits.
-
- The first option will not work with an OS which do not rely on signal
- semaphores to resume task execution when tasks have indicated that they
- "need something to continue." For such a system, you would create a lowest
- priority task and determine how often it is given the chance to decline
- running or patch your task dispatcher to keep your statistics for you.
-
- As most drives are now asynchronous, you would need to actually hook or
- patch the file- or drive sub- system to report drive usage unless time
- spent waiting to serve data to drive versus amount of time spent writing is
- your concern, in which case you would employ a system similar to the first
- scheme above.
-
-
- Take care!
- ---
- Brian Valters McGroarty -- brianmcg@bix.com
- phone/fax (847) 439-7714
-